package com.mystore.dao;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

/**
 * 基础dao
 * @param <T>
 */
public interface BaseDao<T> {
    /**
     * 更新数据库对象,增删改
     * @param sql
     * @param params
     * @param connection
     * @return
     * @throws SQLException
     */
     boolean updateByPreparedStatement(String sql, List<Object>params,Connection connection) throws SQLException;

    /**
     * 查找单个实体对象
     * @param sql
     * @param params
     * @param cls
     * @param connection
     * @param <T>
     * @return
     * @throws Exception
     */
    <T>T findSingleResult(String sql, List<Object> params,Class<T> cls,Connection connection) throws Exception;

    /**
     * 查找对象实体类
     * @param sql
     * @param params
     * @param cls
     * @param connection
     * @param <T>
     * @return
     * @throws Exception
     */
    <T> List<T> findMoreRefResult(String sql, List<Object> params,
                                  Class<T> cls,Connection connection) throws Exception;
}
